package com.zbkj.front.controller.burying_point;

import com.zbkj.common.model.burying_point.UserPageRemainDate;
import com.zbkj.common.request.UserPageRemainDateRequest;
import com.zbkj.common.result.CommonResult;
import com.zbkj.service.service.burying_point.UserPageRemainDateService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.BeanUtils;
import org.springframework.web.bind.annotation.*;


/**
 * 用户页面停留时长表 前端控制器
 */
@Slf4j
@RestController
@RequestMapping("api/user-page-remain-date")
@Api(tags = "用户页面停留时长表") //配合swagger使用

public class UserPageRemainDateController {

    @Autowired
    private UserPageRemainDateService userPageRemainDateService;


    /**
     * 新增用户页面停留时长表
     * @param userPageRemainDateRequest 新增参数
     * @author keNan
     * @since 2025-04-28
     */
    @ApiOperation(value = "新增")
    @RequestMapping(value = "/save", method = RequestMethod.POST)
    public CommonResult<String> save(@RequestBody @Validated UserPageRemainDateRequest userPageRemainDateRequest) {
        UserPageRemainDate userPageRemainDate = new UserPageRemainDate();
        BeanUtils.copyProperties(userPageRemainDateRequest, userPageRemainDate);

        if(userPageRemainDateService.save(userPageRemainDate)) {
            return CommonResult.success();
        } else {
            return CommonResult.failed();
        }
    }


}



